//! \file DiceExtensions.cpp
//! \brief TODO: Document
// -----------------------------------------------------------------------------
//! This program is free software; you can redistribute it and/or
//! modify it under the terms of the GNU General Public License
//! as published by the Free Software Foundation; either version 2
//! of the License, or (at your option) any later version.
//!
//! This program is distributed in the hope that it will be useful,
//! but WITHOUT ANY WARRANTY; without even the implied warranty of
//! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//! GNU General Public License for more details.
//!
//! You should have received a copy of the GNU General Public License
//! along with this program; if not, write to the Free Software Foundation,
//! Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
// -----------------------------------------------------------------------------

#include "DiceExtensions.h"

// =====[ Local Definitions ]===================================================

// =====[ Local DataTypes ]=====================================================

// =====[ Local Variables ]=====================================================

// =====[ Local Functions ]=====================================================

// =====[ Private (Internal) Methods ]==========================================

// =====[ Local Implementation ]================================================


namespace DnD
{

  using namespace std;


// TODO: for now only support NumberOf = 1
int rollDiscardLowest(string Expression, int NumberOf)
{
  int Value;
  int LowValue = 7; // 1 higher then max 1d6.
  int Result = 0;
  int Index;

  // Roll 1d6 4 times and discard the lowest roll.
  for (Index = 0; Index < 4; Index++)
  {
    Value = mROLL("1d6");
    Result+= Value;
    if (Value < LowValue)
      { LowValue = Value; }
  }

  // Subtract the low value off.
  Result-= LowValue;

  return (Result);

  // TODO: there's also something in here with a 1d100 but I am unable to find
  // it atm.

}


//  DiceExtensions::DiceExtensions()
//  {
//    // TODO Auto-generated constructor stub
//
//  }
//
//  DiceExtensions::~DiceExtensions()
//  {
//    // TODO Auto-generated destructor stub
//  }

}
